package com.example.demo.service.impl;

import com.example.demo.domain.Code;
import com.example.demo.enums.StatusEnum;
import com.example.demo.repository.CodeRepository;
import com.example.demo.service.CodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Author zhengmf
 * @Date 2018/12/28  16:39
 */
@Service
@Transactional
public class CodeServiceImpl implements CodeService {
    @Autowired
    private CodeRepository codeRepository;
    @Override
    public void saveCode(Code code) {
        code.setStatus(StatusEnum.E.name());
        codeRepository.save(code);
    }

    @Override
    public void updateStatus(Long id) {
        codeRepository.updateStatus(StatusEnum.D.name(),id);
    }
}
